<?php
extract($_POST);
$url = $_SERVER['DOCUMENT_ROOT'] . $_SERVER['REQUEST_URI'];
$url = substr($url, 0, strrpos($url, '/', 0));

//echo $url . "/";
$uploaddir = $url . "/". $time . "_";
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
$peso = $_FILES['userfile']['size'];
$tipo = $_FILES['userfile']['type'];

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
  echo "success;$peso;$tipo";
} else {
  echo "error";
}
?>
